﻿@{
    Layout = "~/Views/Shared/_Dialog.cshtml";
}
@model EC.Entity.Response.IpTable.IpTableResponse
<section class="container-fluid" style="background-color: white;">
    <div class="data-wrap case">
        <div class="data-tool clearfix">
            <div class="pull-left form-inline ">
            </div>
            <div class="pull-right">
                <form class="form-inline" id="form">
                    <input type="hidden" id="bankId" name="Id" value="@(Model!=null?Model.Id:0)" />
                    <div class="row m10_t">
                        <div class="col-xs-2 m10_t">
                            <label for="GrounpName" class="control-label">分组</label>
                        </div>
                        <div class="col-xs-4">
                            <input class="form-control" type="text" id="GrounpName" name="GrounpName" value="@(Model!=null?Model.GrounpName:string.Empty)" />
                        </div>
                        <div class="col-xs-2 m10_t">
                            <label for="Account" class="control-label">账号</label>
                        </div>
                        <div class="col-xs-4">
                            <input class="form-control" type="text" id="Account" name="Account" value="@(Model!=null?Model.Account:string.Empty)" />
                        </div>
                    </div>
                    <div class="row m10_t">
                        <div class="col-xs-2 m10_t">
                            <label for="Type" class="control-label">系统类型</label>
                        </div>
                        <div class="col-xs-4">
                            <select name="type" class="form-control">
                                <option value="-1">选择类型</option>
                                @{
                                    foreach (var item in (IDictionary<int, string>)ViewBag.SystemType)
                                    {
                                        if (Model != null && Model.Type == item.Key)
                                        {
                                            <option value="@(item.Key)" selected>@(item.Value)</option>
                                        }
                                        else
                                        {
                                            <option value="@(item.Key)">@(item.Value)</option>
                                        }

                                    }
                                }
                            </select>
                        </div>
                        <div class="col-xs-2 m10_t">
                            <label for="Status" class="control-label">状态</label>
                        </div>
                        <div class="col-xs-4">
                            <select name="Status" class="form-control">
                                <option value="-1">选择状态</option>
                                @if (Model != null && Model.Status == 1)
                                {
                                    <option value="1" selected>启用</option>
                                }
                                else
                                {

                                    <option value="1">启用</option>
                                }

                                @if (Model != null && Model.Status == 0)
                                {
                                    <option value="0" selected>禁用</option>
                                }
                                else
                                {
                                    <option value="0">禁用</option>
                                }
                            </select>
                        </div>
                    </div>
                    <div class="row m10_t">
                        <div class="col-xs-2 m10_t">
                            <label for="IPS" class=" control-label">IP</label>
                        </div>
                        <div class="col-xs-10">
                            <textarea class="form-control" rows="5" cols="20" type="text" id="IPS" name="IPS">@(Model!=null?Model.Ips:string.Empty)</textarea>
                        </div>
                    </div>
                    <div class="row m10_t">
                        <div class="col-xs-2 m10_t">
                            <label for="Remark" class=" control-label">备注</label>
                        </div>
                        <div class="col-xs-10">
                            <input class="form-control" type="text" id="Remark" name="Remark" value="@(Model!=null?Model.Remark:string.Empty)" />
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</section>
@section footerScript{

    <script type="text/javascript">

        function save() {
            var cover = FlashPay.UI.Mask({
                obj: $("body"),
                opacity: 0.5
            });
            var data = $("#form").serializeJSON();
            FlashPay.Util.Ajax({
                type: "POST",
                url: "/iptable/SaveIptable",
                data: data,
                success: function (res) {
                    if (res.success) {
                        cover.Remove();
                        FlashPay.UI.DialogOpener().Tip_success("操作成功！");
                        FlashPay.UI.DialogOpener().doSearch();
                        FlashPay.UI.CloseDialog();
                    } else {
                        cover.Remove();
                        FlashPay.UI.Tip_short_warning("操作失败！" + res.message);
                    }
                },
                error: function (json) {
                    cover.Remove();
                    FlashPay.UI.Tip_warning("操作失败！请查看网络，请重试。");
                }
            });

        }
    </script>
}